package com.nursing.think.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.nursing.think.R;

import java.util.List;

/**
 * Created by Administrator on 2019/10/24.
 */

public class SpinnerAdapter extends BaseAdapter {
    private Context context;
    private String[] teamList;
    public SpinnerAdapter(Context baseActivityBar, String[] teamList) {
        context = baseActivityBar;
        this.teamList = teamList;
    }

    @Override
    public int getCount() {
        return teamList.length;
    }

    @Override
    public Object getItem(int position) {
        return teamList[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null){
            convertView = LinearLayout.inflate(context, R.layout.spinner_item,null);
        }
        TextView menuTextView = (TextView) convertView.findViewById(R.id.menuTextView);
        menuTextView.setText(teamList[position]);
        return convertView;
    }
}
